class Product < ActiveRecord::Base
  attr_accessible :name, :price, :description, :category_id, :image, :availability, :active

  has_one   :category
  has_many  :cart_items
  has_many  :carts, :through => :cart_items

  has_attached_file :image, :styles => {:medium => "300x300", :thumb => "100x100"}

  validates :name, :presence => true, :uniqueness => true
  validates :price, :presence => true
  validates :category_id, :presence => true
end